window.URL = window.URL || window.webkitURL;

module.exports = (blob, resolve) => {
	var _blob = URL.createObjectURL(new Blob([`this.onmessage =  function(e) {
		postMessage(new FileReaderSync().readAsDataURL(e.data))
	}`], { 
				type: 'application/javascript'
			}));
	var worker = new Worker(_blob);
	worker.onmessage = (event) => {
		resolve(event.data)
		URL.revokeObjectURL(_blob)
	}
	worker.postMessage(blob)
}
